package com.hermes.comics.data;

import android.graphics.Color;
import android.os.Environment;

import java.util.Comparator;

public class Constants {

  private Constants() {
    // not instantiable
  }

  public static final String UPDATE_FORM_URI =
       "https://docs.google.com/forms/d/1yjzkWmu4SAXirohODaOtvbnVl3znsbNaoAmvW-g7sLE/formResponse?entry.1871400607=";

  private static final String GDRIVE_KEY = "0AkFOipE2LA6KdDhMYU1yQVU3SHduUHhVVkh1Y1p6Qmc";
  private static final String PREFIX_DOWNLOAD_DATA_URI = 
      "https://docs.google.com/spreadsheet/pub?key=" + GDRIVE_KEY + "&output=txt";

  public static final String SERIES_URI = PREFIX_DOWNLOAD_DATA_URI + "&gid=0";
  public static final String ISSUES_URI = PREFIX_DOWNLOAD_DATA_URI + "&gid=1";

  public static final String DB_PATH = Environment.getExternalStorageDirectory() + "/ComicsCollection/";
  public static final String SERIES_FILENAME = "comics-series.tsv";
  public static final String ISSUES_FILENAME = "comics-issues.tsv";

  public static final String EXTRACTION_URL = "com.hermes.comics.EXTRACTION_URL";
  public static final String EXTRACTION_MODE = "com.hermes.comics.EXTRACTION_MODE";

  public static final String SERIE_KEY = "com.hermes.comics.SERIE_KEY";
  public static final String SERIE_GROUP_KEY = "com.hermes.comics.SERIE_GROUP_KEY";
  public static final String ISSUE_KEY = "com.hermes.comics.ISSUE_KEY";
  public static final String ISSUES_MODE_KEY = "com.hermes.comics.ISSUES_MODE_KEY";
  public static final String ISSUES_MODE_ALL = "1";
  public static final String ISSUES_MODE_MISSING = "2";

  public static final String[] LANGUAGE_VALUES = new String[] { "pt", "en", "sp" };

  public static final String RED_HTML = "#900000"; 
  public static final String BLUE_HTML = "#006699";

  public static final String DELIMITER_FIELD = "#";
  public static final String DELIMITER_VALUE = "\\|";

  public static final int RED = Color.parseColor(RED_HTML);
  public static final int BLUE = Color.parseColor(BLUE_HTML);
  public static final int ORANGE = Color.parseColor("#FFA500");
  public static final int GRAY = Color.parseColor("#FFFFFF");

  public static final Comparator<Serie> SERIE_COMPARATOR = new Comparator<Serie>() {
    @Override
    public int compare(Serie s1, Serie s2){  
      return s1.getTagValue(SerieTag.TITLE, "").compareToIgnoreCase(
          s2.getTagValue(SerieTag.TITLE, ""));  
    }  
  };
}
